<?php
/*
	Rss-aggregator php script : Aggregate rss feeds to display it as needed
	Visit http://www.rss-aggregator.com for more help.
	Copyright (C) 2008 DAHU.FR

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

	include('fonctions/mesfonctions.php');

	if ($_POST['Psw']!='' &&  $_POST['Psw'] == $PswAdmin)
	{

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta name="author" content="Gaston BOUCHAYER" />
	<meta name="keywords" content="" />
	<meta name="description" content="" />
		<title>RSS-aggregator.com : Feeds aggregator for webmasters - Admin</title>
	<link href="./admin.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="./js/prototype.js"></script>
</head>

<body lang="fr" xml:lang="fr" >


<div class="logo">
	<br />
	<img src="./logo.jpg" />
</div>
<br />

<div class="principale">	<!-- DIV PRINCIPALE -->

<table>
	<tr>
		<td class="generalegauche">	<!-- PARTIE GÉNÉRALE GAUCHE -->

<div>
	<br />
	<div class="intitule"> ADD A FEED : </div>
	<br />
	<form>
		<div>
			<label> URL : <input type="text" size="40" name="URLFlux1" id="URLFlux1"/> </label>
			<input type="button" name="AjouterFlux" id="AjouterFlux" value="Add" onclick="javascript:afficher_form_ajouter_flux(), URLFlux1.value=''" />
		</div>
	</form>
</div>
	
<br /><br />
<div class="intitule"> FEEDS LIST : </div> <br />
<?php
	$requete1 = "SELECT * from RSSAflux ORDER BY FLUid";
	$resultat1 = mysql_query ($requete1, $connexion);
	if ($resultat1)
	{
?>
		<div id="ListeFlux">
<?php
			$FLUidexistant = '';
			while ($flux = mysql_fetch_object ($resultat1))
			{
				$FLUidexistant = $flux->FLUid;
				$FLUnom = utf8_decode($flux->FLUnom);
	?>
				<div id="Flux<?php echo $flux->FLUid; ?>">
					<table>
						<tr>
							<td width="220px"> <?php echo '- ', $FLUnom; ?> </td>
							<td> <a href="javascript:afficher_form_modifier_flux(<?php echo $flux->FLUid; ?>)" class="liens"> Modify </a> </td>
							<td> <a href="javascript:supprimer_flux(<?php echo $flux->FLUid; ?>)" class="liens"> Delete </a> </td>
							<td> <a href="javascript:afficher_form_modifier_tag(<?php echo $flux->FLUid; ?>)" class="liens"> Tags </a> </td>
						</tr>
					</table>
				</div>
<?php
			}
?>
		</div>
<?php
	}	
?>

<br /><br />
<div class="intitule"> GET PHP CODE FOR DISPLAY : </div> <br />
<form>
	<label>
		Sorting :
		<select name="ChoixTri" id="ChoixTri" onchange="javascript:affich_articles(this.value)" >
			<option value="" > </option>
			<option value="ByDate" > By Date </option>
			<option value="ByFlux" > By Feed </option>
		</select>
	</label> <br />
	<label>	Number of articles : <input type="text" name="NbArt" id="NbArt" size="3" value="" /> </label>
	<span id="AffichArt"></span> <br />
	<label>
		Tags :
		<select name="ChoixTag" id="ChoixTag" >
			<option value=""> All </option>
<?php
	$requete3 = "SELECT * from RSSAtag ORDER BY TAGtag";
	$resultat3 = mysql_query ($requete3, $connexion);
	if ($resultat3)
	{
		while ($tag = mysql_fetch_object ($resultat3))
		{
			$tag = $tag->TAGtag;
			if($temporaire != $tag) 
			{
				echo '<option value="'.$tag.'"> '.$tag.' </option>';
				echo "\n";
				$temporaire = $tag;
			}
		}
	}
?>
		</select>
	</label> <br />
	<label>
		Templates :
		<select name="ChoixTemplate" id="ChoixTemplate" >
<?php
	if ($handle = opendir($CHEMIN))
	{
		while (false !== ($file = readdir($handle)))
		{
			$pos = strpos($file, 'TEMPLATE');
			if ($file != "." && $file != ".." && $pos !== false)
			{
				echo '<option value='.$file.'> '.$file.' </option>';
				echo "\n";
			}
		}
		closedir($handle);
	}
?>
		</select>
	</label> <br />
	<input type="button" name="AffichCode" id="AffichCode" value="Get Code" onclick="javascript:afficher_code()" />
</form>

<?php
	// On récupère la valeur du temps de rafraîchissement
	$requete2 = "SELECT * from RSSAconfig";
	$resultat2 = mysql_query ($requete2, $connexion);
	if ($resultat2)
	{
		while ($config = mysql_fetch_object ($resultat2))
		{
			$CONrafraich = $config->CONrafraich/60;
?>
			<br /><br />
			<div class="intitule"> OTHER : </div>
			<br />
			<form>
				<label> Refresh time : <input type="text" name="TpsRafraich" id="TpsRafraich" size="3" 
				value="<?php echo $CONrafraich; ?>" />min </label>
				<input type="button" name="MAJTpsRafraich" id="MAJTpsRafraich" value="Update" onclick="javascript:modifier_tps_rafraich()" />
			</form>
<?php
		}
	}
?>

		</td>
		<td class="affichinfo" id="AffichInfo">	<!-- FIN PARTIE GÉNÉRALE GAUCHE -->
			<br />
			<div class="intitule"> Create your own template : </div>
			<br />
			Create a directory <i><b>TEMPLATE_name</b></i> in the <i><b>rssa</b></i> directory. The display by date is made with one file named <i><b>bydate.php</b></i>. The display by feed is made with two files named <i><b>channel_byflux.php</b></i> and <i><b>item_byflux.php</b></i>. The styles of these templates will be in a file named <i><b>index.css</b></i>. We already propose some templates. Do not hesitate to take example above.
			
			<br /><br /><br />
			<div class="intitule"> Build your own template : </div>
			<br />
			{FEED_NAME} : display the name of the feed <br />
			{CHAN_STYLE} : display the style given to the feed <br />
			{CHAN_URL} : display the URL of the feed <br />
			{CHAN_TITLE} : display the title of the feed <br />
			{CHAN_LINK} : display the link of the feed <br />
			{CHAN_DESC} : display the description of the feed <br />
			{CHAN_RIGHT} : display the copyright of the feed <br />
			{CHAN_LOGO} : display the logo of the feed <br />
			{ITEM_STYLE} : display the style given to the article <br />
			{ITEM_TITLE} : display the title of the article <br />
			{ITEM_LINK} : display the link of the article <br />
			{ITEM_DESC} : display the description of the article <br />
			{ITEM_AUT} : display the author of the article <br />
			{ITEM_THEIRDATE} : display the date of the article with the original format <br />
			{ITEM_DATE} : display the date of recovery of article with the chosen format <br />
			
			<br /><br /><br />
			For all other questions, go to see the <a href="http://www.rss-aggregator.com/faq.php" target="_blank" class="faq"> F.A.Q.</a>
			<br /><br />
		</td>
	</tr>
</table>

</div>	<!-- FIN DIV PRINCIPALE -->
<br />

<script type="text/javascript" src="./js/admin.js"></script>

<?php
	}	// Fin du if (isset($_POST["Loguer"]) && !empty($_POST["Psw"]) &&  $_REQUEST['Psw'] == $PswAdmin)
	else
	{
		header('location: ./index.php');
	}
?>


</body>
</html>

